import type { AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios'

interface IInterceptors {
  reqInterceptor?: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig
  reqInterceptorCatch?: (err: any) => any
  resInterceptor?: (res: AxiosResponse) => AxiosResponse
  resInterceptorCatch?: (err: any) => any
}

export interface IRequestConfig extends AxiosRequestConfig {
  interceptors?: IInterceptors
}

/**
 * 通用数据类型
 */
export interface IApiData<T = any> {
  code: number
  data: T
  msg: string
}

/**
 * 分页数据类型
 */
export interface IPage<T = any> {
  total: number
  records: T[]
}
